<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="../script/print.js"></script>
	<meta name="author" content="liunan">		
	<title>出入库明细</title>
<script type="text/javascript">
	var org = Common.cOrg();		//当前单位	
	var qt = {};					//数据表格对象
	var qt1= {}						//回收卡表格对象
	var inited = false;				//初始化标志	
	
	function load(){
		Eui.showNavigation();
		setPages(["listview","amply","printBillDetail"]);
		
		Eui.initBeginDateInput("beginTimeTd","起始日期","searchForm","beginTime","endTime","_pastDate");
		Eui.initEndDateInput("endTimeTd","结束日期","searchForm","beginTime","endTime","_pastDate");
		
		var statusList = [];
		tlist =  Common.getItems("cardbill_status");
		for(var i = 0;i<tlist.length;i++){
			var b = tlist[i];
			if(b.code==Constants.CARDBILL_STATUS_PASSAGE||b.code==Constants.CARDBILL_STATUS_ACCPECTED||b.code==Constants.CARDBILL_STATUS_CANCELED||b.code==Constants.CARDBILL_STATUS_CANCEL){
				statusList.push(b);
			}
		}
		Common.initDict(searchForm.billType,"cardbill_type","全 部");
		Common.initDict(searchForm.estate,statusList,"全 部");
		Common.initDict(searchForm.cardStatus,CardStore.getStoreStatus(),"全 部");	
		searchForm.organization.value = org.id;
		searchForm.orgName.value = org.name
		createTable();
	}
	//查询刷新
	function checkQuery(){
		if(!checkForm(searchForm))return;
		qt.showTable();
	}
	//出入库单据列表	
	function createTable(){
		var columns = []
		columns[0] = {render:number};
		columns[11] = {defOrder:true};
		
		qt = new QueryTable("go_enter_list_query","searchForm","datalist",columns);
	}
	function number(v,r){
		return "<a href=# onclick=\"onQuery("+r[0]+","+r[10]+");return false;\">"+v+"</a>";		
	}
	//显示、刷新表格
	function showData(){
		qt.showTable();				
	}
	//对应明细页面
	function onQuery(id,subType,cardType){
	var printBill = false;
	if(subType == CardBillSubType.IN_BUSINESS || subType == CardBillSubType.OUT_BUSINESS){
			document.all.requestframe.style.height=200;
	}else{
		document.all.requestframe.style.height="93%";
		printBill = true;
	}
	
		switchPage("amply");
		requestframe.document.location.href = "card_bill_detail.html?cardBillId="+id+"&readOnly=true"+"&printBill="+printBill+"&printDispaly=true";
	}
	function onBack(){
		switchPage('listview');
		//showData();
	}	
	function selCardType(){
		var v = openDialogFrame("/basic/card_type_list.html?",'请选择卡片类型',464,700);
		searchForm.cardType.value=v[1];
	}
	//选择机构方法
	function setOrg(sorg) {
		searchForm.orgName.value = sorg.name;
	    $("organization").value = sorg.id;
	}
//-------------------------------------------------------------
</script>
</head>
<body onload="load()"> 
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<!--查询静态页面部分-->
	<div id="listview">	
		<!--查询条件form-->
		<div class="searchForm">
			<form id = "searchForm" name="searchForm">
				<input type="hidden" name="organization"/>
				<table cellSpacing=0 cellPadding=4 width="100%" border=0 class="col3 label4">
					<tr>
						<td><label>单据编号</label> <input type="text" name="serialID" onblur="checkV(this,'number')" maxlength=12></td>
						<td><label>单据类型</label> <select name="billType"><option></option></select></td>
						<td><label>单据状态</label> <select name="estate"></select></td>
					</tr>
					<tr>
						<td id="beginTimeTd"></td>
						<td id="endTimeTd"></td>
					 	<td><label>卡片类型</label> <input type="text" name="cardType"><a class=orga title="选择类型" href="javascript:void(0)" onclick="selCardType()">&nbsp;&nbsp;</a></td>
					</tr>
					<tr>	
						<td><label>卡片状态</label> <select name="cardStatus" ><option></option></select></td>
						<td><label>机构名称</label> <input type="text" name="orgName" class="readonly"> <a class="orga" href="#" onclick="SystemMgnt.selOrg(setOrg);">&nbsp;&nbsp;</a></td>
						<td><button type="button" onclick="checkQuery()">查 询</button></td>
					</tr> 
				</table>
			</form>
		</div>
		<!--查询结构列表-->
		<div id="datalist"></div>
	</div>
	<div id="amply" style="display:none;">
		<iframe id="requestframe" name="requestframe" style="width:100%;height:93%;overflow:auto;" frameborder=0 src=""></iframe>
	</div>

	<div id="printBillDetail" class="form" style="display:none;">
		<div class="formTitle">
			<div class="l">单据预览</div>
			<div class="r">
				<button onclick="WebPrint.preview('content')">打印预览</button>
		 		<button onclick="WebPrint.print('content')">打印</button>
		 		<button onclick="onBack()">返回</button>
			</div>
		</div>
		<div  id="content" align='center'></div>
	</div>
</body>
</html>